home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / language / harvest.cpt / Harvest C / Tcl 6.2 / test.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-21  |  1.4 KB  |  67 lines

  1.  
  2. #include <stdio.h>
  3. #include <math.h>
  4. #include <sane.h>
  5.  
  6. main()
  7. {
  8.     printf ( "This is \\n -> %d[x%02X] \\r -> %d[x%02X]\n",
  9.             '\n', '\n', '\r', '\r');
  10.     
  11. #ifdef NEVER_DEFINED
  12. double a, b, c;
  13. long ex;
  14.  
  15.     a = 0.0;
  16.     b = 5.0;
  17.     
  18.     c = a / b;
  19.     if ( ex = testexception( INVALID | UNDERFLOW | OVERFLOW | DIVBYZERO | INEXACT) )
  20.         {
  21.         fprintf(stderr, "ONE: HAVE EXCEPTION\n");
  22.         }
  23.     fprintf(stderr, "%lf / %lf = %lf\n", a, b, c);
  24.     
  25.     c = b / a;
  26.     if ( ex = testexception( INVALID | UNDERFLOW | OVERFLOW | DIVBYZERO | INEXACT) )
  27.         {
  28.         fprintf(stderr, "TWO: HAVE EXCEPTION x%08lX [%ld]\n", ex, ex);
  29.         if (testexception( INVALID ))
  30.             fprintf(stderr, "INVALID\n");
  31.         else if (testexception( UNDERFLOW ))
  32.             fprintf(stderr, "UNDERFLOW\n");
  33.         else if (testexception( OVERFLOW ))
  34.             fprintf(stderr, "OVERFLOW\n");
  35.         else if (testexception( DIVBYZERO ))
  36.             fprintf(stderr, "DIVBYZERO\n");
  37.         else if (testexception( INEXACT ))
  38.             fprintf(stderr, "INEXACT\n");
  39.         }
  40.     fprintf(stderr, "%lf / %lf = %lf\n", a, b, c);
  41. #endif
  42.  
  43.     exit(0);
  44.     }
  45.  
  46. #ifdef NEVER_DEFINED
  47.  
  48. C {active}
  49. Link -t MPST -c 'MPS ' ╢
  50.     {active}.o        ╢
  51.     {Libraries}RunTime.o ╢
  52.     {Libraries}Interface.o ╢
  53.     {CLibraries}StdCLib.o ╢
  54.     {CLibraries}CSANELib.o
  55. Link.out
  56.  
  57. This is \n -> 13[x0D] \r -> 10[x0A]
  58.  
  59. 0.000000 / 5.000000 = 0.000000
  60. TWO: HAVE EXCEPTION x00000001 [1]
  61. DIVBYZERO
  62. 0.000000 / 5.000000 = INF
  63. 0.000000 / 5.000000 = 0.000000
  64. 0.000000 / 5.000000 = INF
  65.  
  66. #endif
  67.